Skip to main content

AddUser

Sets a user to the current protected range.

Syntax

expression.AddUser(sId, sName, protectedRangeUserType);

expression - A variable that represents a ApiProtectedRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sIdRequiredstringThe user ID.
sNameRequiredstringThe user name.
protectedRangeUserTypeRequiredProtectedRangeUserTypeThe user type of the protected range.

Returns

ApiProtectedRangeUserInfo | null

Example

This example changes the the user protected range.

var oWorksheet = Api.GetActiveSheet();
oWorksheet.AddProtectedRange("protectedRange", "$A$1:$B$1");
var protectedRange = oWorksheet.GetProtectedRange("protectedRange");
protectedRange.AddUser("userId", "name", "CanView");